
#include "vxSqlite3.h"
#include "vxConstDef.h"

vxSqlite3::vxSqlite3()
: m_pDB(NULL)
{

}

vxSqlite3::~vxSqlite3()
{
	if (IsOpen())
		Close();
}

int	vxSqlite3::Open(const char* szFileName)
{
	if (IsOpen())
		Close();

	CHECKF (szFileName);
	int nRes = sqlite3_open(szFileName, &m_pDB);

	return RET_OK;
}

int	vxSqlite3::IsOpen()
{
	return (NULL != m_pDB);
}

int	vxSqlite3::Close()
{
	if (m_pDB)
		sqlite3_close(m_pDB);

	return RET_OK;
}

int		vxSqlite3::Exec(const char* szSQL)
{
	if (!szSQL || !IsOpen())
		return RET_ERROR;

	sqlite3_exec(m_pDB, szSQL, NULL, NULL, NULL);

	return RET_OK;
}

IDBRecord*	vxSqlite3::MakeRecord(const char* szTable)
{
	if (!szTable)
		return NULL;

//	IDBRecord* pRecord = vxSqlite3Record::CreateNew();

}
